package cn.neusoft.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
@ToString
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Order {

    private Integer orderId; //主键 数字  自增
    private String orderNumber; //字符串编号 通常有生成策略
    private Integer userId; //用户编号   哪个用户在下单
    private Integer businessId; //商家编号   在哪个商家下单

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date orderDate;
    private Double orderTotal;
    private Integer addressId; //用户地址编号
    private Integer orderState; //状态  0 未支付  1 已支付

    private User user;
    private Business business;
    private Address address;

    public Order(Integer orderId, String orderNumber, Integer userId, Integer businessId, Date orderDate, Double orderTotal, Integer addressId, Integer orderState) {
        this.orderId = orderId;
        this.orderNumber = orderNumber;
        this.userId = userId;
        this.businessId = businessId;
        this.orderDate = orderDate;
        this.orderTotal = orderTotal;
        this.addressId = addressId;
        this.orderState = orderState;
    }

    private List<OrderDetail> orderDetailList = new ArrayList<>();
}
